<%@ page import="com.qf.entity.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.qf.entity.Admin" %>
<%--
  Created by IntelliJ IDEA.
  User: Ken
  Date: 2022/3/30
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h1>学生列表</h1>

    <table border="1">
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>操作</th>
        </tr>

        <!-- 如果学生列表不等于空 -->
        <c:if test="${not empty stus}">
            <c:forEach items="${stus}" var="stu">
                <tr>
                    <td>${stu.name}</td>
                    <td>${stu.age}</td>
                    <td>${stu.sex == 1 ? '男' : '女'}</td>
                    <td>
                        <c:if test="${fn:contains(login_user.powers, '3')}">
                            <button onclick="javascript:location.href='deletestudent?dname=${stu.name}'">删除</button>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
        </c:if>
    </table>
</body>
</html>
